<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>

<body>
    <div id="app"></div>
    <template id="my-app">
        <h2>{{message}} -- {{message}}</h2>
        <h2>{{count*2}}</h2>
        <h2>{{reverse()}}</h2>

        <h1>{{mood}}</h1>
        <button @click="remove">切换心情</button>
    </template>
    <script>
        const App = {
            template: '#my-app',
            data() {
                return {
                    message: 'the world',
                    count: 100,
                    mood:'开心'
                }
            },
            methods: {
                reverse() {
                    return this.message.split(' ').reverse().join(' ')
                },
                remove() {
                    this.mood = this.mood === '开心'? '不开心' : '开心'
                }
            }
        }
        Vue.createApp(App).mount('#app')
    </script>
</body>

</html>